if SERVER then AddCSLuaFile("shared.lua") end

if CLIENT then
   ENT.PrintName = "pf_ball"

end

ENT.Type = "anim"
ENT.Model = Model("models/hunter/misc/sphere025x025.mdl")

function ENT:Initialize()
	self:SetModel(self.Model)

	self:PhysicsInit(SOLID_VPHYSICS)
	self:SetMoveType(MOVETYPE_VPHYSICS)

	self:SetSolid(SOLID_BBOX)

	self:SetCollisionGroup(COLLISION_GROUP_NONE )
	if SERVER then
		self:SetMaxHealth(200)
		self:PhysWake()
		local phys = self:GetPhysicsObject()
		if IsValid(phys) then
			phys:EnableMotion(true)
			phys:SetMass(200)
		end

	end
	self:SetColor(255,255,255,255)

end

function ENT:StartTouch( ent )
	if (ent:GetClass() == "prop_physics") then return end
	if ( !ent:IsValid() and !ent:IsPlayer() ) then return end
	umsg.Start("ball_holder")
		umsg.Entity(ent)
	umsg.End()
	ent:PrintMessage( HUD_PRINTCENTER, "You have picked up the ball!" )
	ent:Give("weapon_ball")
	ent:SelectWeapon("weapon_ball")	
	self:Remove()
end

function ENT:Draw()
	self:DrawModel()
	local a = CurTime()*100
	cam.Start3D2D(self:GetPos() + Vector(0, 0, 18), Angle( 0,a,90 ), 0.8)
		draw.DrawText("Ball", "DefaultBold", 0, 0, Color(255,255,255), TEXT_ALIGN_CENTER )			
	cam.End3D2D()
	cam.Start3D2D(self:GetPos() + Vector(0, 0, 18), Angle( 0,a-180,90 ), 0.8)
		draw.DrawText("Ball", "DefaultBold", 0, 0, Color(255,255,255), TEXT_ALIGN_CENTER )			
	cam.End3D2D()
	
end

function ENT:Use(ply)
 
end

-- traditional equipment destruction effects
function ENT:OnTakeDamage(dmginfo)
  
end


/*
if SERVER then AddCSLuaFile("shared.lua") end

if CLIENT then
   ENT.PrintName = "pf_ball"
end
ENT.Model = Model("models/Gibs/HGIBS.mdl")
function ENT:Initialize()

	self:SetModel(self.Model)		
	self:PhysicsInit( SOLID_VPHYSICS )
	self:SetMoveType( MOVETYPE_VPHYSICS )
	local phys = self:GetPhysicsObject()
	if phys:IsValid() then
		phys:EnableMotion(true)
	end
	
end


function ENT:Draw()
	local a = CurTime()*100
	cam.Start3D2D(self:GetPos() + Vector(0, 0, 8), self:GetAngles() + Angle( 0,a,90 ), 3)
		draw.DrawText(team.GetScore(1), "DefaultBold", 0, 0, team.GetColor(1), TEXT_ALIGN_CENTER )			
	cam.End3D2D()
end

*/
